

<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>json example</title>
</head>
<body>
<form id="form1">
<input type="hidden" id="assigned_treasure_json" value='[{"code": "5648771867544b528c12f3ed813edc1e", "scan_user": null, "create_user": null, "effective_from": "2017-04-20T17:01:01", "scan_at": null, "modify_at": "2017-04-20T17:01:04.877528", "active": true, "id": 4, "name": "宝物002", "category": "1", "effective_to": null, "x_axis": "123", "create_at": "2017-04-20T17:01:04.878024", "qrcode": "/media/qrcodes/5648771867544b528c12f3ed813edc1e.png", "remarks": "", "redeem_at": "2017-04-20T17:00:55", "y_axis": "234", "modify_user": null}, {"code": "a75ae03a0a5c45d18f4da0dc26bbcf2b", "scan_user": null, "create_user": null, "effective_from": "2017-04-20T17:01:21", "scan_at": null, "modify_at": "2017-04-20T17:01:49.629877", "active": true, "id": 5, "name": "宝物003", "category": "1", "effective_to": null, "x_axis": "111", "create_at": "2017-04-20T17:01:27.111871", "qrcode": "/media/qrcodes/a75ae03a0a5c45d18f4da0dc26bbcf2b.png", "remarks": "", "redeem_at": null, "y_axis": "222", "modify_user": null}]' />
</form>
<script type="text/javascript">
	// var json_str = JSON.stringify(document.getElementById("assigned_treasure_json").value);
	var json_str = document.getElementById("assigned_treasure_json").value
	var json_obj = JSON.parse(json_str);	
	Array.from(json_obj).forEach(function (p) {
	  console.log("obj:" +p);
	  alert(p.name + '\n' +p.code + '\n' + p.active + '\n' + p.category + '\n' + p.x_axis + '\n' + p.y_axis)
	});
</script>
</body>
</html>